package restful

import (
	"net/http"

	"gitee.com/aviptle/goclean/go11jin/vblog01/apps/blog"
	"github.com/infraboard/mcube/client/rest"
)

func NewClient(token string) *Client {
	// 获取一个RestfulClient
	c := rest.NewRESTClient()
	// axios
	c.SetBaseURL("http://127.0.0.1:8010")
	c.SetCookie(&http.Cookie{
		Name:  "token",
		Value: token,
	})
	return &Client{
		c: c,
	}

}

// address, 核心http client
type Client struct {
	c *rest.RESTClient
}

func (c *Client) BlogClient() blog.Service {
	return &BlogClient{
		c: c.c,
	}
}
